<!DOCTYPE html>
<html>
  
  <head>
    <meta charset="UTF-8">
    <title>${sysconf.proname}</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="./css/font.css">
    <link rel="stylesheet" href="./css/xadmin.css">
    <script type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="./lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="./js/xadmin.js"></script>
        <script type="text/javascript" src="./js/showtable.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="js/html5.min.js"></script>
      <script src="js/respond.min.js"></script>      
    <![endif]-->
  </head>
  
  <body style="overflow-x: scroll;">
    <div class="x-nav">
      <span class="layui-breadcrumb">
        <a>日志管理</a><a><cite>日志记录</cite></a>
      </span>
      <a class="layui-btn layui-btn-small sxBtn" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon">&#xe669;</i></a>
    </div>
    <div class="x-body">
      <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so">
        	<div class="layui-input-inline">
	        	<span>操作时间：</span>
	        	<input class="layui-input" placeholder="开始日" name="start_time" id="start_time">
	            <span>至</span>
	          <input class="layui-input" placeholder="截止日" name="end_time" id="end_time">
          </div>
          <div class="layui-input-inline">
          	<span>操作账号：</span>
	        	<input class="layui-input"  name="phone" type="text" value=""/>
          </div>
          <div class="layui-input-inline">
          	<span>场景说明：</span>
	        	<input class="layui-input"  name="scenename" type="text" value=""/>
          </div>
          <div class="layui-input-inline">
          	<span>请求参数：</span>
	        	<input class="layui-input"  name="params" type="text" value=""/>
          </div>
        
          <a class="layui-btn serBtn" onclick="searchs()"><i class="layui-icon">&#xe615;</i>搜索</a>
        </form>
      </div>
	
      <table class="layui-table" id="test"  lay-data="{height:'550', url:'statement/findaActionlogList',parseData:function(data){return parseData(data)},page:true, id:'test',toolbar:true}"  lay-filter="test" style="margin: 0; min-width: 1300px;">
      	 <thead>
		    <tr>
		      <th lay-data="{field:'ROWNUM_', width:80, sort: true}">序号</th>
		      <th lay-data="{field:'PHONE',width:130}">操作账号</th>
		      <th lay-data="{field:'USERNAME',width:130}">操作人姓名</th>
		      <th lay-data="{field:'IP',width:130}">IP</th>
		      <th lay-data="{field:'SCENENAME', width:180, sort: true}">场景说明</th>
		      <th lay-data="{field:'SCENEURL', width:200, sort: true}">场景链接</th>
		      <th lay-data="{field:'PARAMS',minWidth:180}">请求参数</th>
		      <th lay-data="{field:'CREATETIME', width:165}">操作时间</th>
		    </tr>
		  </thead>
      </table>
     
    </div>
		<script type="text/javascript">
		
		function searchs(){
			var start_time = $("input[name=start_time]").val();
			var end_time = $("input[name=end_time]").val();
			var scenename = $("input[name=scenename]").val();
			var phone = $("input[name=phone]").val();
			var params = $("input[name=params]").val();
			var wheres = {};
			wheres.start_time = start_time;
			wheres.end_time = end_time;
			wheres.scenename = scenename;
			wheres.phone = phone;
			wheres.params = params;

			
			table.reload('test', {
			  url: 'statement/findaActionlogList'
			  ,where: wheres //设定异步数据接口的额外参数
			  ,page:true
			});
		}
		
		
		function status(res){
			if(res==0){
				return"待审核";
			}else if(res==1){
				return "使用中";
			}else if(res==2){
				return "未通过";
			}else if(res==3){
				return "已锁定";
			}else if(res==4){
				return "已注销";
			}
		}
		
		function toolbar(data){
			var html='<a class=\"on\" onClick=\"x_open_show(\'编辑详情\',\'editApp?orgid='+data.ORG_ID+'&id='+data.ID+'\',\'900px\',\'550px\')\"><i class=\"layui-icon\">&#xe642;</i> 编辑</a>&#12288'
			if(#(session.usertype>=5)){
				if(data.STATUS==1){
					return html+='<a class=\"on\" onclick=\"updateState(4,'+data.ID+')\"><i class=\"layui-icon\">&#xe640;</i> 注销</a>'
				}else if(data.STATUS==4){
					return '<a ><i class=\"layui-icon\">&#xe642;</i> 编辑</a>&#12288<a ><i class=\"layui-icon\">&#xe640;</i> 注销</a>'
				}else{
					return html+='<a ><i class=\"layui-icon\">&#xe640;</i> 注销</a>'
				}
			
			}else{
				if(data.STATUS==0){
					return '<a class=\"on\" onclick=\"updateState(1,'+data.ID+')\"><i class=\"layui-icon\">&#xe605;</i> 通过</a>&#12288<a class=\"on\" onclick=\"updateState(2,'+data.ID+')\"><i class=\"layui-icon\">&#x1006;</i> 拒绝</a>'
				}else if(data.STATUS==1){
					return html+='<a class=\"on\" onclick=\"updateState(3,'+data.ID+')\"><i class=\"layui-icon\">&#xe651;</i> 停用</a>'
				}else if(data.STATUS==2){
					return html+='<a ><i class=\"layui-icon\">&#xe652;</i> 启用</a>'
				}else{
					return html+='<a class=\"on\" onclick=\"updateState(1,'+data.ID+')\" ><i class=\"layui-icon\">&#xe652;</i> 启用</a>'
				}
			}

		}
		
	
		
	  var types = [];
      layui.use([ 'laydate','layer','table'], function(){
		    var $ = layui.$;
		    var laydate = layui.laydate;
		    var nowTime = new Date().valueOf();
		    table = layui.table;
		    var max = null;
		    
		    if('#(appname)'!=""){
			 $("input[name=channel_name]").val('#(appname)');
			searchs();
		}
		    
		    $.post("app/findType",{},function(data){ //初始化服务类型
				if(data.res==1){
					types = data.list;
					var html = '<option value="">全部</option>';
					for(var i in types){
						var dddd = types[i];
						var list11 = dddd.LIST;
						html+='<optgroup label="'+dddd.CERTIFY_NAME+'">'
						
						for(var j in list11){
							var ddd2 = list11[j]
							html+='<option value="'+ddd2.ID+'">'+ddd2.CERTIFY_NAME+'</option>'
						}
						
						html+='</optgroup>';
					}
					console.log(html)
					$("#types").html(html);
					form.render("select");
				}
			},"JSON")
		    
		    
		
		       var start = laydate.render({
		        elem: '#start_time',
		        type: 'date',
		        max: nowTime,
		        btns: ['clear', 'confirm'],
		        done: function(value, date){
		            endMax = end.config.max;
		            end.config.min = date;
		            end.config.min.month = date.month -1;
		        }
		    });
		    var end = laydate.render({
		        elem: '#end_time',
		        type: 'date',
		        max: nowTime,
		        done: function(value, date){
		            if($.trim(value) == ''){
		                var curDate = new Date();
		                date = {'date': curDate.getDate(), 'month': curDate.getMonth()+1, 'year': curDate.getFullYear()};
		            }
		            start.config.max = date;
		            start.config.max.month = date.month -1;
		        }
		    });
			 $('.queryBtn').on('click', function(){
			    layer.open({
		        type: 1,
		        offset: 'auto',
		        content: '<div style="padding: 20px 30px;"><img src="images/ewm.png" style="width:200px;"/></div>',
		        btn: '关闭',
		        btnAlign: 'c',
		        yes: function(){
		          layer.closeAll();
		        }
		      });
			  });
			  
			 /*   //监听工具条
			  table.on('row(test)', function(obj){
			    var data = obj.data;
			    data.STATUS = 2
			    table.render()
			  });  */
			  
		 })
		 
		 
		  
		 
		 
		 
		 
		 
	
		</script>

  </body>

</html>